/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FormPengiriman.java
 *
 * Created on Apr 7, 2011, 1:37:59 PM
 */

package com.kifas.ui.finance;

import com.kifas.model.xml.AkunMasterModel;
import com.kifas.model.xml.BukuPiutangModel;
import com.kifas.sales.ui.*;
import com.kifas.model.xml.PenjualanDetailModel;
import com.kifas.model.xml.PenjualanModel;
import com.kifas.model.xml.PersistStatus;
import com.kifas.model.xml.PiutangModel;
import com.kifas.model.xml.ReferenceNumberingModel;
import com.kifas.service.MainService;
import com.kifas.service.MasterService;
import com.kifas.ui.util.TextComponentUtils;
import java.awt.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.table.AbstractTableModel;
import org.jdesktop.beansbinding.AutoBinding.UpdateStrategy;
import org.jdesktop.beansbinding.BindingGroup;
import org.jdesktop.swingbinding.JComboBoxBinding;
import org.jdesktop.swingbinding.SwingBindings;

/**
 *
 * @author dhamarsu
 */
public class FormCetakInvoice extends javax.swing.JInternalFrame {
    private List<PenjualanDetailModel> penjualanDetailModels;
    private PenjualanModel p;
    private MasterService masterService = new MasterService();
    private List<AkunMasterModel> akunMasterModels;
    
    /** Creates new form FormPengiriman */
    public FormCetakInvoice() {
        initComponents();
        txtTanggal.setDate(new Date());

        akunMasterModels = masterService.getMasterAkuns();

        BindingGroup bindingGroup = new BindingGroup();
        
        JComboBoxBinding akunPiutangBinding =
                SwingBindings.createJComboBoxBinding(
                UpdateStrategy.READ,
                akunMasterModels,
                cboAkunPiutang);

        cboAkunPiutang.setRenderer(new DefaultListCellRenderer() {
           @Override
           public Component getListCellRendererComponent(
                   JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
               super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
               if (value instanceof AkunMasterModel) {
                   AkunMasterModel mec = (AkunMasterModel)value;
                   setText(mec.getNama());
               }
               return this;
           }
        });
        bindingGroup.addBinding(akunPiutangBinding);

        JComboBoxBinding akunPajakBinding =
                SwingBindings.createJComboBoxBinding(
                UpdateStrategy.READ,
                akunMasterModels,
                cboAkunPajak);

        cboAkunPajak.setRenderer(new DefaultListCellRenderer() {
           @Override
           public Component getListCellRendererComponent(
                   JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
               super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
               if (value instanceof AkunMasterModel) {
                   AkunMasterModel mec = (AkunMasterModel)value;
                   setText(mec.getNama());
               }
               return this;
           }
        });
        bindingGroup.addBinding(akunPajakBinding);
        bindingGroup.bind();

        tableOrder.setAutoCreateColumnsFromModel(false);
        penjualanDetailModels = new ArrayList<PenjualanDetailModel>();
        tableOrder.setModel(new PenjualanTableModel(penjualanDetailModels));
    }

    public FormCetakInvoice(PenjualanModel penjualanModel) {
        initComponents();

        tableOrder.setAutoCreateColumnsFromModel(false);
        penjualanDetailModels = new ArrayList<PenjualanDetailModel>();
        tableOrder.setModel(new PenjualanTableModel(penjualanDetailModels));
        
        p = new PenjualanModel();
        p = penjualanModel;
         if (p != null){
             JOptionPane.showMessageDialog(null, p.getNoPenjualan());
            txtNoSales.setText(p.getNoPenjualan());
            txtCustomer.setText(p.getCustomer().getNama());
            txtAlamat.setText(p.getCustomer().getAlamat1());
            txtAlamatKirim.setText(p.getAlamatKirim());
            dtTglOrder.setDate(p.getTanggal());
            txtTanggal.setDate(new Date());

            penjualanDetailModels = new ArrayList<PenjualanDetailModel>(p.getPenjualanDetails());

            refreshTable();
            refreshTotalLabel();
         }
    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jTextField6 = new javax.swing.JTextField();
        jToolBar1 = new javax.swing.JToolBar();
        btnSave = new javax.swing.JButton();
        btnCancel = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtTanggal = new com.toedter.calendar.JDateChooser();
        txtNoSales = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        txtNoInvoice = new javax.swing.JTextField();
        btnDialogOrder = new javax.swing.JButton();
        txtCustomer = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        dtTglOrder = new com.toedter.calendar.JDateChooser();
        jLabel5 = new javax.swing.JLabel();
        cboAkunPiutang = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        cboAkunPajak = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtAlamat = new javax.swing.JTextArea();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtAlamatKirim = new javax.swing.JTextArea();
        jPanel6 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        txtTglJtTempo = new com.toedter.calendar.JDateChooser();
        jScrollPane6 = new javax.swing.JScrollPane();
        txtSyaratBayar = new javax.swing.JTextArea();
        jLabel4 = new javax.swing.JLabel();
        txtNoRef = new javax.swing.JTextField();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tableOrder = new javax.swing.JTable();
        jPanel7 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        txtSubTotal = new javax.swing.JLabel();
        txtPajak = new javax.swing.JLabel();
        txtTotal = new javax.swing.JLabel();
        txtDiscount = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        txtKeterangan = new javax.swing.JTextArea();
        jLabel20 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        txtPajak1 = new javax.swing.JLabel();

        jTabbedPane2.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
        jTabbedPane2.setName("jTabbedPane2"); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "No", "Gudang", "Kode Barang", "Nama Barang", "Qty", "Satuan", "Terkirim", "Harga", "DIsc(%)", "Discount", "PPN", "Sub Total"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.String.class, java.lang.Double.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jTable1.setName("jTable1"); // NOI18N
        jScrollPane1.setViewportView(jTable1);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 887, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 863, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 139, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGap(5, 5, 5)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jTabbedPane2.addTab("Daftar Item", jPanel3);

        jTextField6.setEditable(false);
        jTextField6.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTextField6.setName("jTextField6"); // NOI18N

        setClosable(true);
        setIconifiable(true);
        setTitle("Form Cetak Invoice (Piutang)");

        jToolBar1.setRollover(true);
        jToolBar1.setName("jToolBar1"); // NOI18N
        jToolBar1.setPreferredSize(new java.awt.Dimension(512, 75));

        btnSave.setText("Save");
        btnSave.setAutoscrolls(true);
        btnSave.setName("btnSave"); // NOI18N
        btnSave.setPreferredSize(new java.awt.Dimension(100, 37));
        btnSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSaveActionPerformed(evt);
            }
        });
        jToolBar1.add(btnSave);

        btnCancel.setText("Cancel");
        btnCancel.setName("btnCancel"); // NOI18N
        btnCancel.setPreferredSize(new java.awt.Dimension(100, 37));
        btnCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelActionPerformed(evt);
            }
        });
        jToolBar1.add(btnCancel);

        jButton3.setText("Print");
        jButton3.setName("jButton3"); // NOI18N
        jButton3.setPreferredSize(new java.awt.Dimension(100, 37));
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton3);

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N

        jPanel4.setName("jPanel4"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 172, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 147, Short.MAX_VALUE)
        );

        jLabel1.setText("No Penjualan");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel3.setText("Tanggal");
        jLabel3.setName("jLabel3"); // NOI18N

        txtTanggal.setDateFormatString("dd/MM/yyyy");
        txtTanggal.setName("txtTanggal"); // NOI18N

        txtNoSales.setName("txtNoSales"); // NOI18N

        jLabel2.setText("Customer");
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel16.setText("No Invoice");
        jLabel16.setName("jLabel16"); // NOI18N

        txtNoInvoice.setText("AUTO");
        txtNoInvoice.setName("txtNoInvoice"); // NOI18N

        btnDialogOrder.setText(".........");
        btnDialogOrder.setName("btnDialogOrder"); // NOI18N
        btnDialogOrder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDialogOrderActionPerformed(evt);
            }
        });

        txtCustomer.setEditable(false);
        txtCustomer.setName("txtCustomer"); // NOI18N

        jLabel6.setText("Tgl Order");
        jLabel6.setName("jLabel6"); // NOI18N

        dtTglOrder.setDateFormatString("dd/MM/yyyy"); // NOI18N
        dtTglOrder.setName("dtTglOrder"); // NOI18N

        jLabel5.setText("Akun Piutang");
        jLabel5.setName("jLabel5"); // NOI18N

        cboAkunPiutang.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cboAkunPiutang.setName("cboAkunPiutang"); // NOI18N

        jLabel14.setText("Akun Pajak");
        jLabel14.setName("jLabel14"); // NOI18N

        cboAkunPajak.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cboAkunPajak.setName("cboAkunPajak"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cboAkunPiutang, 0, 179, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel1)
                                .addComponent(jLabel16))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(txtNoInvoice)
                                .addComponent(txtNoSales, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnDialogOrder, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(39, 39, 39)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel3))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(txtTanggal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(dtTglOrder, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cboAkunPajak, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21)
                .addComponent(txtCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(txtNoSales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnDialogOrder)
                            .addComponent(jLabel6)))
                    .addComponent(dtTglOrder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(txtNoInvoice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboAkunPiutang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5)
                            .addComponent(jLabel14)
                            .addComponent(cboAkunPajak, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(txtTanggal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(64, 64, 64)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Pengiriman", jPanel1);

        jPanel2.setName("jPanel2"); // NOI18N

        jLabel9.setText("Alamat");
        jLabel9.setName("jLabel9"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        txtAlamat.setColumns(20);
        txtAlamat.setEditable(false);
        txtAlamat.setFont(new java.awt.Font("SansSerif", 0, 13));
        txtAlamat.setRows(5);
        txtAlamat.setName("txtAlamat"); // NOI18N
        jScrollPane2.setViewportView(txtAlamat);

        jLabel10.setText("Alamat Kirim");
        jLabel10.setName("jLabel10"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        txtAlamatKirim.setColumns(20);
        txtAlamatKirim.setFont(new java.awt.Font("SansSerif", 0, 13));
        txtAlamatKirim.setRows(5);
        txtAlamatKirim.setName("txtAlamatKirim"); // NOI18N
        jScrollPane3.setViewportView(txtAlamatKirim);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addGap(48, 48, 48)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(198, 198, 198))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Alamat", jPanel2);

        jPanel6.setName("jPanel6"); // NOI18N

        jLabel12.setText("Syarat Bayar");
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel13.setText("Tgl Jth Tempo");
        jLabel13.setName("jLabel13"); // NOI18N

        txtTglJtTempo.setDateFormatString("dd/MM/yyyy");
        txtTglJtTempo.setName("txtTglJtTempo"); // NOI18N

        jScrollPane6.setName("jScrollPane6"); // NOI18N

        txtSyaratBayar.setColumns(20);
        txtSyaratBayar.setFont(new java.awt.Font("SansSerif", 0, 13));
        txtSyaratBayar.setRows(5);
        txtSyaratBayar.setText("-");
        txtSyaratBayar.setName("txtSyaratBayar"); // NOI18N
        jScrollPane6.setViewportView(txtSyaratBayar);

        jLabel4.setText("No Ref");
        jLabel4.setName("jLabel4"); // NOI18N

        txtNoRef.setEditable(false);
        txtNoRef.setName("txtNoRef"); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtNoRef)
                    .addComponent(txtTglJtTempo, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
                .addGap(38, 38, 38)
                .addComponent(jLabel12)
                .addGap(26, 26, 26)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)
                .addGap(249, 249, 249))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
                    .addComponent(jLabel12)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(txtTglJtTempo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNoRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel4)))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Pembayaran", jPanel6);

        jTabbedPane3.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
        jTabbedPane3.setName("jTabbedPane3"); // NOI18N

        jPanel5.setName("jPanel5"); // NOI18N

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        tableOrder.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Kode Barang", "Nama Barang", "Qty", "Satuan", "Harga", "Discount", "Pajak", "Sub Total"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.Long.class, java.lang.String.class, java.lang.Double.class, java.lang.Double.class, java.lang.Object.class, java.lang.Double.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tableOrder.setName("tableOrder"); // NOI18N
        tableOrder.setRowHeight(24);
        jScrollPane4.setViewportView(tableOrder);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 956, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane3.addTab("Daftar Item", jPanel5);

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Biaya"));
        jPanel7.setName("jPanel7"); // NOI18N

        jLabel7.setText("Sub Total");
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setText("Pajak");
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel11.setText("Discount");
        jLabel11.setName("jLabel11"); // NOI18N

        jLabel17.setText("Total");
        jLabel17.setName("jLabel17"); // NOI18N

        txtSubTotal.setFont(new java.awt.Font("DejaVu Sans", 1, 14));
        txtSubTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        txtSubTotal.setText("0");
        txtSubTotal.setName("txtSubTotal"); // NOI18N

        txtPajak.setFont(new java.awt.Font("DejaVu Sans", 1, 14));
        txtPajak.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        txtPajak.setText("0");
        txtPajak.setName("txtPajak"); // NOI18N

        txtTotal.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
        txtTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        txtTotal.setText("0");
        txtTotal.setName("txtTotal"); // NOI18N

        txtDiscount.setFont(new java.awt.Font("DejaVu Sans", 1, 14));
        txtDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        txtDiscount.setText("0");
        txtDiscount.setName("txtDiscount"); // NOI18N

        jLabel18.setText("Keterangan");
        jLabel18.setName("jLabel18"); // NOI18N

        jScrollPane5.setName("jScrollPane5"); // NOI18N

        txtKeterangan.setColumns(20);
        txtKeterangan.setRows(5);
        txtKeterangan.setText("-");
        txtKeterangan.setName("txtKeterangan"); // NOI18N
        jScrollPane5.setViewportView(txtKeterangan);

        jLabel20.setText("Biaya Lain");
        jLabel20.setName("jLabel20"); // NOI18N

        jSeparator1.setName("jSeparator1"); // NOI18N

        txtPajak1.setFont(new java.awt.Font("DejaVu Sans", 1, 14));
        txtPajak1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        txtPajak1.setText("0");
        txtPajak1.setName("txtPajak1"); // NOI18N

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addGap(40, 40, 40)
                        .addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel8)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel11)
                            .addComponent(jLabel7)
                            .addComponent(jLabel20))
                        .addGap(26, 26, 26)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtPajak1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtPajak, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtSubTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtDiscount, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 206, Short.MAX_VALUE)))
                .addGap(126, 126, 126)
                .addComponent(jLabel18)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel18)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11)
                            .addComponent(txtDiscount))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(txtSubTotal))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(txtPajak))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtPajak1)
                            .addComponent(jLabel20))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(txtTotal))))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 988, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 964, Short.MAX_VALUE)
                    .addComponent(jTabbedPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 964, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(16, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

    private void btnDialogOrderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDialogOrderActionPerformed
        // TODO add your handling code here:
         p = new OrderPenjualanLookUp(null, true, "pengiriman").getPenjualanModel();
         if (p != null){
            txtNoSales.setText(p.getNoPenjualan());
            txtCustomer.setText(p.getCustomer().getNama());
            txtAlamat.setText(p.getCustomer().getAlamat1());
            txtAlamatKirim.setText(p.getAlamatKirim());
            dtTglOrder.setDate(p.getTanggal());
            txtNoRef.setText(p.getNoPenjualan());
            penjualanDetailModels = new ArrayList<PenjualanDetailModel>(p.getPenjualanDetails());

            refreshTable();
            refreshTotalLabel();
         }
    }//GEN-LAST:event_btnDialogOrderActionPerformed

    private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
        // TODO add your handling code here:
        boolean isValid = true;
        if (txtTglJtTempo.getDate() == null ||
                txtSyaratBayar.getText().equals("") || txtTanggal.getDate() == null)
            isValid = false;
        try{
            if(isValid){

                if(txtNoInvoice.getText().equals("") || txtNoInvoice.getText().equals("AUTO")){
                    ReferenceNumberingModel rf = masterService.getReferenceNumber(1, "INV");
                    txtNoInvoice.setText(rf.getResult());
                }

                BigDecimal total = TextComponentUtils.stringToDecimal(txtTotal.getText());

                BigDecimal pajak = TextComponentUtils.stringToDecimal(txtPajak.getText());

                AkunMasterModel akunPiutang = (AkunMasterModel) cboAkunPiutang.getSelectedItem();
                AkunMasterModel akunPajak = (AkunMasterModel) cboAkunPajak.getSelectedItem();

                List<BukuPiutangModel> lBukuPiutang = new ArrayList<BukuPiutangModel>();
                BukuPiutangModel bpmPiutang = new BukuPiutangModel(null, akunPiutang, total, new BigDecimal(0), txtTanggal.getDate(),
                        txtKeterangan.getText(), "0", txtNoInvoice.getText(), "Piutang Penjualan atas nama " + txtCustomer.getText(), new BigDecimal(0));
                
                BukuPiutangModel bpmPajak = new BukuPiutangModel(null, akunPajak, new BigDecimal(0), pajak, txtTanggal.getDate(),
                        txtKeterangan.getText(), "0", txtNoInvoice.getText(), "Pajak PPN penjualan No " + p.getNomorPo(), new BigDecimal(0));
                lBukuPiutang.add(bpmPajak);
                lBukuPiutang.add(bpmPiutang);

                PiutangModel pm = new PiutangModel(null, p.getCustomer(), txtTanggal.getDate(),
                        txtTglJtTempo.getDate(), txtSyaratBayar.getText(),
                        txtNoInvoice.getText(), total, txtKeterangan.getText(),
                        txtNoRef.getText(), lBukuPiutang);

        
                PersistStatus status = MainService.getPenjualanService().setPiutang(pm);
                JOptionPane.showMessageDialog(null, status.getReason(), status.getStatus(), JOptionPane.INFORMATION_MESSAGE);
                if (status.getStatus().equals("success")){
                    btnSave.setEnabled(false);
                }
            }else{
                JOptionPane.showMessageDialog(null, "Tanggal Jatuh Tempo, Syarat Bayar, Tanggal Invoice tidak boleh kosong.");
            }
        }catch(Exception ex){
            ex.printStackTrace();
            txtNoInvoice.setText("");
            JOptionPane.showMessageDialog(null, "Penyimpanan gagal.");
        }
    }//GEN-LAST:event_btnSaveActionPerformed

    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
        // TODO add your handling code here:
        clearForm();
    }//GEN-LAST:event_btnCancelActionPerformed

    private void refreshTotalLabel(){
        if(p != null){
            BigDecimal total = BigDecimal.ZERO;
            BigDecimal pajak = BigDecimal.ZERO;
            for (PenjualanDetailModel detailModel : penjualanDetailModels) {
                total = total.add(detailModel.getSubTotal());
                pajak = pajak.add(detailModel.getPajak());
            }
            txtSubTotal.setText(TextComponentUtils.formatNumber(total));
            txtPajak.setText(TextComponentUtils.formatNumber(pajak));

            txtTotal.setText(TextComponentUtils.formatNumber(total.add(pajak)));
        }else{
            txtSubTotal.setText("0");
            txtPajak.setText("0");
            txtTotal.setText("0");
        }
    }

    private void clearForm(){        
        btnSave.setEnabled(true);
        penjualanDetailModels = new ArrayList<PenjualanDetailModel>();
        p = new PenjualanModel();
        
        txtNoSales.setText("");
        txtAlamat.setText(""); txtAlamatKirim.setText(""); txtCustomer.setText("");
        dtTglOrder.setDate(null);
        txtTanggal.setDate(new Date());
        refreshTable();
        refreshTotalLabel();
    }
    
    private void refreshTable(){
        tableOrder.setModel(new PenjualanTableModel(penjualanDetailModels));
    }

    private class PenjualanTableModel extends AbstractTableModel{
        private List<PenjualanDetailModel> penjualanDetailModels;

        public PenjualanTableModel(List<PenjualanDetailModel> penjualanDetails) {
            this.penjualanDetailModels = penjualanDetails;
        }

        @Override
        public int getRowCount() {
            return penjualanDetailModels.size();
        }

        @Override
        public int getColumnCount() {
            return 5;
        }

        @Override
        public Object getValueAt(int rowIndex, int columnIndex) {
                PenjualanDetailModel s = penjualanDetailModels.get(rowIndex);
                if (columnIndex == 0){
                    if (s.getBarang() != null)
                        return s.getBarang().getKdBarang();
                }else if (columnIndex == 1){
                    if (s.getBarang() != null)
                        return s.getBarang().getNamaBarang();
                }else if (columnIndex == 2){
                    if (s.getQty() != null)
                        return s.getQty();
                }else if (columnIndex == 3){
                    if (s.getBarang().getSatuan().getSatuan() != null)
                        return s.getBarang().getSatuan().getSatuan();
                }else if (columnIndex == 4){
                    if (s.getPrice() != null)
                        return s.getPrice();
                }else if (columnIndex == 5){
                    if (s.getDiscount() != null)
                        return s.getDiscount();
                }else if (columnIndex == 6){
                    if (s.getPajak() != null)
                        return s.getPajak();
                }else if (columnIndex == 7){
                    if (s.getSubTotal() != null)
                        return s.getSubTotal();
                }
                return "";
        }

        @Override
        public Class<?> getColumnClass(int columnIndex) {
            if(columnIndex == 4 || columnIndex == 5 || columnIndex == 6 || columnIndex == 7){
                return BigDecimal.class;
            } else if(columnIndex == 2){
                return Long.class;
            }
            return String.class;
        }

        @Override
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return false;
        }

        @Override
        public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
            
        }


    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnDialogOrder;
    private javax.swing.JButton btnSave;
    private javax.swing.JComboBox cboAkunPajak;
    private javax.swing.JComboBox cboAkunPiutang;
    private com.toedter.calendar.JDateChooser dtTglOrder;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JTable tableOrder;
    private javax.swing.JTextArea txtAlamat;
    private javax.swing.JTextArea txtAlamatKirim;
    private javax.swing.JTextField txtCustomer;
    private javax.swing.JLabel txtDiscount;
    private javax.swing.JTextArea txtKeterangan;
    private javax.swing.JTextField txtNoInvoice;
    private javax.swing.JTextField txtNoRef;
    private javax.swing.JTextField txtNoSales;
    private javax.swing.JLabel txtPajak;
    private javax.swing.JLabel txtPajak1;
    private javax.swing.JLabel txtSubTotal;
    private javax.swing.JTextArea txtSyaratBayar;
    private com.toedter.calendar.JDateChooser txtTanggal;
    private com.toedter.calendar.JDateChooser txtTglJtTempo;
    private javax.swing.JLabel txtTotal;
    // End of variables declaration//GEN-END:variables

}
